home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 June / SGI Freeware 1998 June.iso / dist / fw_python.idb / usr / freeware / doc / python-1.2 / tkinter / packer-simple.py.z / packer-simple.py
Text File  |  1997-09-09  |  739b  |  36 lines

  1. from Tkinter import *
  2.  
  3.  
  4. class Test(Frame):
  5.     def printit(self):
  6.     print self.hi_there["command"]
  7.  
  8.     def createWidgets(self):
  9.     # a hello button
  10.     self.QUIT = Button(self, {'text': 'QUIT', 
  11.                   'fg': 'red', 
  12.                   'command': self.quit})
  13.     
  14.     self.QUIT.pack({'side': 'left', 'fill': 'both'})
  15.  
  16.  
  17.     self.hi_there = Button(self, {'text': 'Hello', 
  18.                       'command' : self.printit})
  19.     self.hi_there.pack({'side': 'left'})
  20.  
  21.     # note how Packer defaults to {'side': 'top'}
  22.  
  23.     self.guy2 = Button(self, {'text': 'button 2'})
  24.     self.guy2.pack()
  25.  
  26.     self.guy3 = Button(self, {'text': 'button 3'})
  27.     self.guy3.pack()
  28.  
  29.     def __init__(self, master=None):
  30.     Frame.__init__(self, master)
  31.     Pack.config(self)
  32.     self.createWidgets()
  33.  
  34. test = Test()
  35. test.mainloop()
  36.